<%@page import="com.df.springmvc.workflow.trace.controller.TraceManageController"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	request.setAttribute("basePath", basePath);
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'Page.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<jsp:include page="/scripts/common/index.html"></jsp:include>
<jsp:include page="/scripts/jquery/index.html"></jsp:include>
<jsp:include page="/scripts/dhtmlx/index.html"></jsp:include>
<jsp:include page="/scripts/bootstrap/index.html"></jsp:include>
<link rel="stylesheet" href="${basePath }style/default.css">
<script>
	var myGrid;
	function init() {
		initData();
		initEvent();
	}
	function initData() {
		query();
	}
	function initEvent() {
		getGrid().attachEvent("onRowDblClicked", function(rowId, cellIndex) {
			var taskId = this.cells(rowId, 1).getValue();
			var url = '${basePath}page/workflow/trace/TraceManage/queryTaskInfo';
			var data = {
				"map.taskId" : taskId
			};
			$.ajax({
					type : 'POST' ,
					url : url ,
					data : data ,
					dataType : "json" ,
					async : true ,
					cache : false ,
					jsonpCallback : "jsonpCallback" ,
					success : function(response, status, statusText) {
						//alert(response + ":" + status + ":" + statusText);
						if (response.status) {
							var content = response.content;
							if (content["guid"] && content["guid"] != "") {
								top.query=query;
								topW = SN.getTopWindowByUrl(content["name"], content["w"], content["h"], "" + content["url"], {
									"guid" : content["guid"],
									"map.guid" : content["guid"],
									"act_form_guid" : content["guid"],
									"act_form_taskId" : taskId
								});
							} else {
								alert("任务号" + taskId + "关联的表单guid无法找到");
							}
						} else {
							alert(response.content);
						}
					}
			});
		});
	}
	//重置查询框
	function query() {
		var v = getValue();
		$.ajax({
				type : 'POST' ,
				url : 'page/workflow/trace/TraceManage/portlet' ,
				data : v ,
				dataType : "json" ,
				async : true ,
				cache : false ,
				jsonpCallback : "null" ,
				//beforeSend : function(response, status, statusText) {
				//alert(response + ":" + status + ":" + statusText);
				//} ,
				//dataFilter : function(response, status, statusText) {
				//alert(response + ":" + status + ":" + statusText);
				//} ,
				success : function(response, status, statusText) {
					if (response.status) {
						var a = response.content.currentPageNum;
						var b = response.content.allPageNum;
						var c = response.content.allCount;
						setValue(a, b, c);
					} else {
						alert(response.content);
					}
				} ,
				error : function(response, status, statusText) {
					//alert(response + ":" + status + ":" + statusText);
				} ,
				complete : function(response, status, statusText) {
					//alert(response + ":" + status + ":" + statusText);
				}
		});
	}
</script>
</head>
<style>
.fv-form-bootstrap .help-block {
	width: 0px;
	height: 0px;
}
</style>
<body onload="init()">
	<form class="form-horizontal MyForm" id="MyForm" name="MyForm" method="post" target="MyFrame" enctype="multipart/form-data">
		<table class="listTableClass" border="0" cellpadding="0" cellspacing="0">
			<tr class="listTrClass">
				<td>
					<table class="listTableClass">
						<tr class="listTrClass">
							<td>
								<jsp:include page="/common/grid_toolbar.jsp">
									<jsp:param value="query" name="func" />
									<jsp:param value="setValue" name="setValue" />
									<jsp:param value="getValue" name="getValue" />
									<jsp:param value="getGrid" name="getGrid" />
									<jsp:param value="getGridSelectValues" name="getGridSelectValues" />
									<jsp:param value="false" name="isPaging" />
								</jsp:include>
							</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
	</form>
</body>
</html>
